package fr.esipe.eioc3.timetableontime_v2;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.provider.SyncStateContract.Columns;

public class FormationOpenHelper extends SQLiteOpenHelper {
	
	 private static final String DATABASE_NAME = "formation.db";
	    private static final int DATABASE_VERSION = 2;

	    public static final String FORMATION_TABLE_NAME = "formationList";
	    public static final String FORMATION_COLUMN1_GROUP = "filiere";
	    public static int  FORMATION_COLUMN1_GROUP_NUM = 1;

	    public static final String FORMATION_COLUMN2_NAME = "name";
	    public static int  FORMATION_COLUMN2_NAME_NUM = 2;

	    public static final String FORMATION_COLUMN3_ID = "formId";
	    public static int  FORMATION_COLUMN3_ID_NUM = 3;

	    
	    private static final String FORMATION_TABLE_CREATE = 
	    		"CREATE TABLE " + FORMATION_TABLE_NAME + " (" +	Columns._ID 		+ " INTEGER PRIMARY KEY, " +
	    														FORMATION_COLUMN1_GROUP + " TEXT, " +											    		
	    														FORMATION_COLUMN2_NAME	+ " TEXT, " +											    		
	    														FORMATION_COLUMN3_ID 	+ " TEXT " 	+	");";

	    public FormationOpenHelper(Context context) {
	        super(context, DATABASE_NAME, null, DATABASE_VERSION);
	    }

	    @Override
	    public void onCreate(SQLiteDatabase db) {
	        db.execSQL(FORMATION_TABLE_CREATE);

	    }

	    @Override
	    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	        db.execSQL("DROP TABLE IF EXISTS " + FORMATION_TABLE_NAME);

	        onCreate(db);
	    }


	

}
